#ifndef DATAPARSE_H
#define DATAPARSE_H

#include <QObject>
#include <QJsonDocument>

#include "BaseGlobal.h"
#include "BaseStruct.h"

class QRecord;
class BASE_EXPORT DataParse : public QObject
{
	Q_OBJECT

public:
	DataParse(QObject *parent = 0);
	~DataParse();

public:
	bool parse(const QByteArray & data);
	JsonDataType getType();
	QString getErrorMsg();

	bool getValue(QString & msg);
	bool getRequest(QString & msg);
	bool getResponse(QString & msg);

	bool operator >> (QRecord & dsRecord);

private:
	QString strError;
	JsonDataType jsonType;
	QJsonDocument jsonDoc;
};

#endif // DATAPARSE_H
